import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'
import * as directives from '@/directives'

// 打印功能
import Print from 'vue-print-nb'
Vue.use(Print)

// console.log(directives) // 返回一个对象
// console.log(Object.keys(directives)) // 返回自定属性名，是一个数组，可以装多个自定义属性名
Object.keys(directives).forEach(keys => {
  Vue.directive(keys, directives[keys].inserted)
})

// 自定义插件
import myPlguin from '@/components'
// 注册
Vue.use(myPlguin)

import '@/icons' // icon
import '@/permission' // permission control
// import { forEach } from 'core-js/core/dict'

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */

// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
